Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Added raise from clause to exceptions for improved tracebacks #27918

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

Sai-Suraj-27
Copy link
Contributor

PR Description

The from keyword sets the __cause__ attribute of the exception, which stores the "cause" of the exception. The availability of an exception "cause" is useful for debugging.

When you raise a new exception after another exception was caught it's likely that the second exception is a friendly re-wrapping of the first exception. In such cases raise from provides a better link between the two tracebacks in the final error.

Related Issue

Closes #27917

Checklist

  • Did you add a function?
  • Did you add the tests?
  • Did you run your tests and are your tests passing?
  • Did pre-commit not fail on any check?
  • Did you follow the steps we provided?

Socials

@ivy-leaves ivy-leaves added Paddle Paddle Backend JAX Frontend Developing the JAX Frontend, checklist triggered by commenting add_frontend_checklist NumPy Frontend Developing the NumPy Frontend, checklist triggered by commenting add_frontend_checklist Paddle Frontend Developing the Paddle Frontend, checklist triggered by commenting add_frontend_checklist PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist Ivy Functional API Ivy API Experimental Run CI for testing API experimental/New feature or request labels Jan 14, 2024
@KareemMAX KareemMAX merged commit 2f7bc06 into ivy-llc:main Jan 15, 2024
815 of 1093 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ivy API Experimental Run CI for testing API experimental/New feature or request Ivy Functional API JAX Frontend Developing the JAX Frontend, checklist triggered by commenting add_frontend_checklist NumPy Frontend Developing the NumPy Frontend, checklist triggered by commenting add_frontend_checklist Paddle Frontend Developing the Paddle Frontend, checklist triggered by commenting add_frontend_checklist Paddle Paddle Backend PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use raise from to specify exception cause
4 participants